import request from "/@/utils/request";

/**
 * 成绩管理
 * @param params 要传的参数值
 * @returns 返回接口数据
 * @method gradeInfo 成绩信息
 * @method experimentInfo 实验信息
 * @method teacherExperimentInfo 教师实验信息
 * @method getGradeInfo 获取成绩信息
 * @method downloadGradeInfo 下载成绩信息
 * @method gradeEvaluationInfo 成绩评价信息
 * @method getTeacherEvaluationInfo 获取教师评价信息
 * @method getStudentEvaluationInfo 获取学生评价信息
 * @method updateTeacherGrade 教师评分
 * @method updateStudentGrade 学生评分
 * @method lessonInfo 班级信息
 * @method studentGradeInfo 学生成绩信息
 * @method teacherGradeInfo 教师成绩信息
 * @method totalGradeInfo 成绩信息
 */

 export function gradeInfo(params: any) {
    return request({
      url: `file-teacher-grade/query?Page=${params.Page}&teacher_id=${params.teacher_id}`,
      method: "get",
    });
  }

  export function experimentInfo(params: any) {
    return request({
      url: `experiment?lesson_id=${params.lesson_id}&Size=50`,
      method: "get",
    });
  }

  export function teacherExperimentInfo(params: any) {
    return request({
      url: `experiment?teacher_id=${params.teacher_id}&Size=50`,
      method: "get",
    });
  }

  export function getGradeInfo(params: any) {
    return request({
      url: `file-teacher-grade/query?Page=${params.Page}&experiment_id=${params.experiment_id}&experiment_name=${params.experiment_name}&student_id=${params.student_id}&student_name=${params.student_name}&lesson_name=${params.lesson_name}`,
      method: "get",
    });
  }

  export function downloadGradeInfo(params: any) {
    return request({
      url: `file-teacher-grade/query?experiment_id=${params.experiment_id}&experiment_name=${params.experiment_name}&student_id=${params.student_id}&student_name=${params.student_name}&lesson_name=${params.lesson_name}`,
      method: "get",
    });
  }

  export function gradeEvaluationInfo(params: any) {
    return request({
      url: `student-group-grade/query?experiment_id=${params.experiment_id}&evaluator_id=${params.evaluator_id}`,
      method: "get",
    });
  }

  export function getTeacherEvaluationInfo(params: any) {
    return request({
      url: `teacherGrade?experiment_id=${params.experiment_id}&student_id=${params.student_id}`,
      method: 'get'  
    })
  }

  export function updateTeacherGrade(params: any) {
    return request({
      url: `teacherGrade/update/${params.evaluated_id}`,
      method: 'put',
      data: params.info,
    })
  }

  export function getStudentEvaluationInfo(params: any) {
    return request({
      url: `groupGrade?experiment_id=${params.experiment_id}&evaluatee_id=${params.evaluatee_id}&evaluator_id=${params.evaluator_id}`,
      method: 'get',
    })
  }

  export function updateStudentGrade(params: any) {
    return request({
      url: `groupGrade/update/${params.evaluated_id}`,
      method: 'put',
      data: params.info,
    })
  }

  export function lessonInfo() {
    return request({
      url: "lesson?Size=100",
      method: "get",
    });
  }

  export function studentGradeInfo(params: any) {
    return request({
      url: `groupGrade?experiment_id=${params.experiment_id}&Size=200`,
      method: "get",
    });
  }

  export function teacherGradeInfo(params: any) {
    return request({
      url: `teacherGrade?experiment_id=${params.experiment_id}&Size=50`,
      method: "get",
    });
  }

  export function totalGradeInfo(params: any) {
    return request({
      url: `total-grade/query?experiment_id=${params.experiment_id}&Size=50`,
      method: "get",
    });
  }
